﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ChangeCursor : MonoBehaviour
{
    public Sprite normalCursor; //8、未击打的锤子图标
    public Sprite hitCursor; //8、击打的锤子图标
    private Image hammerImage; //8、锤子锤子图标显示

    // Start is called before the first frame update
    void Start()
    {
        Cursor.visible = false; //8、箭头鼠标隐藏
        hammerImage = GetComponent<Image>();
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButton(0))
        { //8、按下鼠标左键时
            hammerImage.sprite = hitCursor; //8、换成击打的图标
        }
        else
        {
            hammerImage.sprite = normalCursor; //8、改成未击打的图标
        }

        hammerImage.rectTransform.position = Input.mousePosition; //8、锤子的图标在屏幕上的位置由鼠标在屏幕上的位置
    }
}
